package com.chinafree.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.chinafree.permission.model.po.UserRolePO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Set;

/**
 * @description: TODO
 * @author: longzix
 * @modified By: longzix
 * @date: Created in 2021/7/23 15:36
 * @version:v1.0
 */

public interface UserRoleMapper  extends BaseMapper<UserRolePO> {

    @Select("select role_id from acl_user_role where deleted =0 and user_id = #{userId}")
    Set<Integer> selectRoleIdListByUserId(@Param("userId") String userId);


    @Select("select user_id from acl_user_role where deleted =0 and role_id = #{roleId}")
    Set<String> selectUserIdListByRoleId(@Param("roleId") Integer roleId);

    @Select("select user_id,user_name from acl_user_role where deleted =0 and role_id = #{roleId}")
    List<UserRolePO> selectUserInfoList(@Param("roleId") Integer roleId);
}
